<template>
  <el-upload>

  </el-upload>
</template>

<script>
import { getFileUrls } from '@/api/uploads'

export default {
  name: 'UserFile',
  components: {  },
  props: {
    listType: {
      type: String,
      default: ''
    },
    accept: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      files: [],
      srcList: []
    }
  },
  watch: {
    ids(n, o) {
      this.getData()
    }
  },
  created() {
    this.getData()
  },
  methods: {
    async getData() {
      this.files = []
      if (this.ids) {
        const res = await getFileUrls(this.ids)
        if (res.data && res.data.length) {
          this.files = res.data
          if (this.accept === 'image/*') {
            res.data.forEach(item => {
              this.srcList.push(item.url)
            })
          }
        }
      }
    }
  }
}
</script>